<?php

use think\migration\Migrator;
use think\migration\db\Column;

class RefundOrderInfo extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('refund_order_info', ['comment' => '司机流转访单退货单']);
        $table->addColumn('store_id', 'integer', ['comment' => '门店ID', 'limit' => 11, 'default' => 0])
            ->addColumn('company_id', 'integer', ['comment' => '公司id', 'limit' => 11, 'default' => 0])
            ->addColumn('dealer_id', 'integer', ['comment' => '经销商id', 'limit' => 11, 'default' => 0])
            ->addColumn('driver_id', 'integer', ['comment' => '司机id', 'limit' => 11, 'default' => 0])
            ->addColumn('company_order_id', 'integer', ['comment' => '公司订单ID', 'limit' => 11, 'default' => 0])
            ->addColumn('warehouse_id', 'integer', ['comment' => '入仓ID', 'limit' => 11, 'default' => 0])
            ->addColumn('product_num', 'integer', ['comment' => '退货总数量', 'limit' => 11, 'default' => 0])
            ->addColumn('cate_num', 'integer', ['comment' => '品类数', 'limit' => 11, 'default' => 0])
            ->addColumn('status', 'integer', ['comment' => '1待入库;2已入库', 'limit' => 4, 'default' => 1])
            ->addColumn('remark', 'string', ['comment' => '备注', 'limit' => 255, 'default' => ''])
            ->addColumn('image', 'string', ['comment' => '图片', 'limit' => 255, 'default' => ''])
            ->addColumn('create_time', 'integer', ['default' => null, 'limit' => 10, 'comment' => '创建时间'])
            ->addColumn('update_time', 'integer', ['default' => null, 'limit' => 10, 'comment' => '更新时间'])
            ->addIndex('company_order_id', ['name' => 'idx_company_order_id'])
            ->addIndex('driver_id', ['name' => 'idx_driver_id'])
            ->addIndex('company_id', ['name' => 'idx_company_id'])
            ->create();
    }
}
